package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.LowCodeServiceInfoModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.domain.dao.LowCodeServiceInfoDao;
import com.xbongbong.pro.domain.entity.LowCodeServiceInfoEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/03/03 16:17
 */
@Service("lowCodeServiceInfoModel")
public class LowCodeServiceInfoModelImpl implements LowCodeServiceInfoModel {

    @Resource
    private LowCodeServiceInfoDao lowCodeServiceInfoDao;

    @Override
    public Integer insert(LowCodeServiceInfoEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return lowCodeServiceInfoDao.insert(entity);
    }

    @Override
    public Integer update(LowCodeServiceInfoEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setUpdateTime(now);
        return lowCodeServiceInfoDao.update(entity);
    }

    @Override
    public List<LowCodeServiceInfoEntity> findEntitys(Map<String, Object> param) {
        return lowCodeServiceInfoDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return lowCodeServiceInfoDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer deleteByKey(Long serviceRegistrationId, String corpid) {
        return lowCodeServiceInfoDao.deleteByKey(serviceRegistrationId, corpid);
    }

    @Override
    public LowCodeServiceInfoEntity getByKey(Long serviceRegistrationId, String corpid) {
        return lowCodeServiceInfoDao.getByKey(serviceRegistrationId, corpid);
    }
}
